<?php

/**
 * Documentation form.
 *
 * @package    espace14
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class DocumentationForm extends BaseDocumentationForm
{
  public function configure()
  {
	$this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'nom'         => new sfWidgetFormTextarea(),
      'description' => new sfWidgetFormTextarea(),
      'url'         => new sfWidgetFormInputFile(),
    ));
	
	 $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nom'         => new sfValidatorString(array('max_length' => 500)),
      'description' => new sfValidatorString(array('max_length' => 3000)),
      'url'         => new sfValidatorFile(array('required' => false,
  		            // 20 megabytes in bytes
  		            'max_size' => '20971520')),
    ));
	
	$this->widgetSchema->setNameFormat('documentation[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::configure();
  }
}
